package com.hanson.comparator;

import com.hanson.pojo.dto.UserAuthority;

import java.util.Comparator;

/**
 * @description: 用户权限排序用的比较器
 * @classname: AuthorityComparator
 * @author: HansonLee
 * @create: 2022/09/14
 **/
public class AuthorityComparator implements Comparator<UserAuthority> {

    @Override
    public int compare(UserAuthority o1, UserAuthority o2) {
        if (o1 == null && o2 == null) return 0;
        String oo1 = "";
        String oo2 = "";
        if (o1 != null){
            oo1 = o1.getAuth();
        }
        if (o2 != null){
            oo2 = o2.getAuth();
        }
        return new StringComparator().compare(oo1,oo2);
    }
}
